package cn._2dland.websocket.handler;

import cn._2dland.websocket.WebSocketConnection;

/**
 * WebSocket事件处理器
 * 
 * @author deadblue
 */
public interface IConnectionHandler {

	/**
	 * 客户端连接时
	 */
	public void onOpen(WebSocketConnection conn);

	/**
	 * 客户端断开时
	 */
	public void onClose(WebSocketConnection conn);

	/**
	 * 文本消息到达时
	 * 
	 * @param text
	 */
	public void onTextMessage(WebSocketConnection conn, String text);

	/**
	 * 二进制消息到达时
	 * 
	 * @param binary
	 */
	public void onBinaryMessage(WebSocketConnection conn, byte[] binary);
	
}
